package com.itheima.fanxing;

import com.itheima.domain.Student;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 泛型方法的使用
 * get
 * remove
 * toArray()
 */
public class Test04 {
    public static void main(String[] args) {
        List<String> list= new ArrayList<>();
        list.add("鹿晗");
        list.add("蔡徐坤");
        list.add("吴亦凡");
        list.add("黄子韬");
        String s = list.get(0);
        System.out.println(s);
        System.out.println("--------------");

        ArrayList<Student> list2= new ArrayList<>();
        list2.add(new Student("鹿晗",30));
        list2.add(new Student("吴亦凡",30));
        list2.add(new Student("黄子韬",27));
        list2.add(new Student("蔡徐坤",22));

        Student student = list2.get(3);
        System.out.println(student);

        Object[] objects = list.toArray();
        System.out.println(Arrays.toString(objects));
         String[] str= new String[list.size()];
        String[] strings = list.toArray(str);
        System.out.println(strings[0].length());
        System.out.println(strings[1].length());
        System.out.println(strings[2].length());
        System.out.println(strings[3].length());

    }





}
